import React, { Component } from 'react'

//接收一个组件作为参数，返回一个新的组件
const foo = (Cmp) => (props) => {
    return (
        <div>
            <div>123</div>
            <Cmp {...props} p="ooo" />
        </div>
    )
}

function Child(props) {
    const { p } = props;
    console.log(p)
    return (
        <div>Child</div>
    )
}

@foo
@foo
class ClassChild extends Component {
    state = {}
    render() {
        return (
            <div>Child123</div>
        );
    }
}

const Foo = foo(foo(Child))

export default class HocPage2 extends Component {
    render() {
        return (
            <div>
                <h3>HocPage2</h3>
                <Foo />
                <ClassChild />
            </div>
        )
    }
}
